#include <stdio.h>

int main()
{
	int a=0, sum=0;
	FILE*fp = fopen("input.txt","r");//有r,w,a
	while(1) {
		fscanf(fp,"%d",&a);
		if(a==0) {
			break;
		}
		sum += a;
	}
	FILE*fp2 = fopen("output.txt","a");
	fprintf(fp2,"%d\n",sum);
	fclose(fp);
	fclose(fp2);
	return 0;
}